package com.example.hanfu;

import com.example.hanfu.firstpage.ShouYeFragment;
import com.example.hanfu.tiku.DaTiFragment;
import com.example.hanfu.zhuanti.ZhuanTiFragment;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

public class MyPageAdapter extends FragmentStateAdapter {


    public MyPageAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        if(position==0){
            return new ShouYeFragment();
        }else if(position==1){
            return new ZhuanTiFragment();
        }else if(position==2){
            return new DaTiFragment();
        }else {
            return new PersonalFragment();
        }

    }

    @Override
    public int getItemCount() {
        return 4;
    }
}
